#include<stdio.h>

int JudgeCount(int a, int b) {
	int tmp, count, num;
	count = 0;
	for (int i = a; i <= b; i++) {
		num = i;
		while (num) {
			tmp = num % 10;
			if (tmp == 8){
				count++;
				break;
			}
			num /= 10;
		}
	}
	return count;
}

int main()
{
	int a, b;
		scanf("%d %d", &a, &b);
		if (a > 0 && a <= b && b < 100000) 
			printf("%d", JudgeCount(a, b));
	return 0;
}